// src/i18n/formatters.js
export const setupFormatters = (i18n) => {
    // 日期格式化
    i18n.global.datetimeFormats = {
      'en': {
        short: {
          year: 'numeric',
          month: 'short',
          day: 'numeric'
        },
        long: {
          year: 'numeric',
          month: 'long',
          day: 'numeric',
          hour: 'numeric',
          minute: 'numeric'
        }
      },
      'zh-CN': {
        short: {
          year: 'numeric',
          month: 'numeric',
          day: 'numeric'
        },
        long: {
          year: 'numeric',
          month: 'numeric',
          day: 'numeric',
          hour: 'numeric',
          minute: 'numeric',
          hour12: false
        }
      }
    };
    
    // 数字格式化
    i18n.global.numberFormats = {
      'en': {
        currency: {
          style: 'currency',
          currency: 'USD'
        },
        decimal: {
          style: 'decimal',
          minimumFractionDigits: 2,
          maximumFractionDigits: 2
        },
        percent: {
          style: 'percent',
          useGrouping: false
        }
      },
      'zh-CN': {
        currency: {
          style: 'currency',
          currency: 'CNY'
        },
        decimal: {
          style: 'decimal',
          minimumFractionDigits: 2,
          maximumFractionDigits: 2
        },
        percent: {
          style: 'percent',
          useGrouping: false
        }
      }
    };
    
    return i18n;
  };